package kr.or.eclipse.democamp;

import java.io.UnsupportedEncodingException;
import java.util.Properties;

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class MailMessageBuilder {
	public MailMessageBuilder() {
	}

	public MimeMessage createMessage(String receiver, String title, String contents) throws UnsupportedEncodingException, MessagingException {
		Properties props = new Properties();
		Session session = Session.getInstance(props);
		MimeMessage msg = new MimeMessage(session);
		msg.setFrom(new InternetAddress("jeeeyul@gmail.com", "이지율", "utf-8"));
		msg.addRecipient(Message.RecipientType.TO, new InternetAddress(receiver));
		msg.setSubject(title, "utf-8");
		msg.setContent(contents, "text/html");
		return msg;

	}
}
